package com.apps.sdses.flink141.demo;

import org.apache.flink.api.java.utils.ParameterTool;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Properties;

/**
 * author: codejiwei
 * date: 2023/9/2
 * desc:
 **/
public class TestJarLibDemo {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        ParameterTool param = ParameterTool.fromArgs(args);
        String file = param.get("properties-file");
        System.out.println("===============file: " + file);


        Properties properties = new Properties();
        properties.load(new StringReader(
                new String(
                        Files.readAllBytes(Paths.get(file)),
                        StandardCharsets.UTF_8)));


        String task = properties.getProperty("task");
        System.out.println("=============task: " + task);

        env.fromElements("flink", "spark", "hive").print();


        env.execute();

    }
}
